<%@ page import="com.informet.ipd.modelo.dao.PTareaActDao" %>
<%@ page import="com.informet.ipd.modelo.vo.PTareaActMVO" %>
<%@ page import="com.informet.ipd.struts.form.PEIForm" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.swing.JOptionPane"%>
<%@ page language="java"  pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="/tags/c" prefix="c"%>

<%
            StringBuffer cadenaSalida = new StringBuffer();
            List lista = null;
            int fkTarea = Integer.parseInt(request.getParameter("fkTarea"));

            PTareaActDao dao = new PTareaActDao();
            PEIForm form1 = new PEIForm();
            PTareaActMVO vo = null;
            try {
                int tipo = Integer.parseInt(request.getParameter("tipo"));

                if (tipo > 0) {



                    int pk = Integer.parseInt(request.getParameter("pk"));
                    double mes1 = Double.parseDouble(request.getParameter("mes1"));
                    double mes2 = Double.parseDouble(request.getParameter("mes2"));
                    double mes3 = Double.parseDouble(request.getParameter("mes3"));
                    double mes4 = Double.parseDouble(request.getParameter("mes4"));
                    double mes5 = Double.parseDouble(request.getParameter("mes5"));
                    double mes6 = Double.parseDouble(request.getParameter("mes6"));
                    double mes7 = Double.parseDouble(request.getParameter("mes7"));
                    double mes8 = Double.parseDouble(request.getParameter("mes8"));
                    double mes9 = Double.parseDouble(request.getParameter("mes9"));
                    double mes10 = Double.parseDouble(request.getParameter("mes10"));
                    double mes11 = Double.parseDouble(request.getParameter("mes11"));
                    double mes12 = Double.parseDouble(request.getParameter("mes12"));
                    double ppto = Double.parseDouble(request.getParameter("ppto"));
                    double total=mes1+mes2+mes3+mes4+mes5+mes6+mes7+mes8+mes9+mes10+mes11+mes12;
                    PTareaActMVO voMan = new PTareaActMVO(pk, mes1, mes2, mes3, mes4, mes5, mes6, mes7, mes8, mes9, mes10, mes11, mes12, fkTarea);
                  
                        dao.spManM(tipo, voMan);

                    


                }





                lista = dao.getListByIdM(fkTarea);
                form1.setListaMeATa(lista);
                cadenaSalida.append("<table id='tabla1' width='99%' align='right' class='userTable'>");
                cadenaSalida.append("<tr class='even' align='center'>");
                cadenaSalida.append("<th class='textoTR'>#</th>");
                cadenaSalida.append("<th class='textoTR'>Anual</th> ");
                cadenaSalida.append("<th class='textoTR'>SemestreI</th>");
                cadenaSalida.append("<th class='textoTR'>SemestreII</th> ");
                cadenaSalida.append("<th class='textoTR'>Editar</th>");
                cadenaSalida.append("<th class='textoTR'>Eliminar</th> ");
                cadenaSalida.append("</tr>");
                int i=1;
                Iterator it = lista.iterator();
                while (it.hasNext()) {
                    vo = (PTareaActMVO) it.next();
                    cadenaSalida.append("<tr align='center'> ");
                    cadenaSalida.append("<td width='10%' align='center'>" +i++ + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + vo.getPPto_Anual() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + vo.getSemestreI() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>" + vo.getSemestreII() + "</td>");
                    cadenaSalida.append("<td width='10%' align='center'>");
                    cadenaSalida.append("<img style='cursor:pointer' title='Editar' alt='Editar' border=0  src='images/b_edit.png' onclick=\"editarT('" + vo.getNUM_PRESATAM_PK() + "','" + vo.getNUM_MES1MEATAM() + "','" + vo.getNUM_MES2MEATAM() + "','" + vo.getNUM_MES3MEATAM() + "','" + vo.getNUM_MES4MEATAM() + "','" + vo.getNUM_MES5MEATAM() + "','" + vo.getNUM_MES6MEATAM() + "','" + vo.getNUM_MES7MEATAM() + "','" + vo.getNUM_MES8MEATAM() + "','" + vo.getNUM_MES9MEATAM() + "','" + vo.getNUM_MES10MEATAM() + "','" + vo.getNUM_MES11MEATAM() + "','" + vo.getNUM_MES12MEATAM() + "');\">");
       
                    cadenaSalida.append("</td>");
                    cadenaSalida.append("<td width='10%' align='center'> ");
                    cadenaSalida.append("<img style='cursor:pointer' title='Eliminar' alt='Eliminar' border=0  src='images/b_drop.png' onclick=\"eliminar('" + vo.getNUM_PRESATAM_PK() + "');\" >");
                    cadenaSalida.append("</td>");
                    cadenaSalida.append("</tr>");
                }
            } catch (Exception e) {
                cadenaSalida.append(e.toString());

            }
            out.print(cadenaSalida);
%>